﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
 CodeBehind="FriendsDetails.aspx.cs" Inherits="Nivdal.FriendsDetails" Theme="SkinFile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="basic_element">
    <div class="red_title">
       <asp:Label ID="FriendsTitleLabel" runat="server" Text="<%$ Resources:Resource, Friends_FriendsTitleLabelText %>" CssClass="white_title"></asp:Label>
    </div>
    <div class="padding5">
    <asp:Panel ID="MessagePanel" runat="server">
        <asp:Label ID="MessageLabel" runat="server" SkinID="GreenSmallHeaderLabel"></asp:Label>
        <br />
    </asp:Panel>
    
     
    <asp:UpdateProgress ID="Progress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="ajaxloader">
                <asp:Image ID="ProgressImage1" runat="server" ImageUrl="~/Images/ajax-loader.gif" />
            </div>
        </ProgressTemplate>        
    </asp:UpdateProgress>
     
     <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
     <ContentTemplate>
     
     <asp:GridView ID="FriendsStatsGridView" runat="server" DataSourceID="MyFriendsDataSourse" AllowPaging="false" AutoGenerateColumns="false"
     SkinID="FrumGrid" OnRowCommand="DeleteFriend">
        <EmptyDataTemplate>
            <asp:Label ID="NoFriendsLabel" runat="server" Text="<%$ Resources:Resource, Friends_NoFriendsLabelText %>" 
            SkinID="GridLabel"></asp:Label>
        </EmptyDataTemplate>
        
        <Columns>
            
            <asp:TemplateField ItemStyle-Width="30%">
                <ItemTemplate>
                   
                        <table cellpadding="3" cellspacing="0" style="display:inline;" >
                            <tr>
                                <td>
                                    <asp:Image ID="UserImage" runat="server" ImageUrl='<%# Eval("Picture") %>' Width="48" AlternateText='<%# Eval("PublicName") %>' />
                                </td>
                               
                                <td>
                                    <asp:Panel ID="FriendPanel" runat="server" Visible='<%# !(bool)Eval("IsTheUser")  %>'>
                                        <asp:HyperLink ID="UserNameHyperlink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("PublicName") %>'
                                        NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("FriendId")%>' ></asp:HyperLink>
                                        <br />
                                        <asp:HyperLink ID="TeamHyperlink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("TeamName") %>'
                                         NavigateUrl='<%# "~/TeamHomePage.aspx?TeamId=" + Eval("TeamId") %>'></asp:HyperLink>
                                    </asp:Panel>
                                     <asp:Label ID="YouLabel" runat="server" Text="<%$ Resources:Resource, Friends_YouLabelText %>"
                                        SkinID="GridLabel" Visible='<%# Eval("IsTheUser") %>'></asp:Label>
                                </td>
                                <%--<td>
                                    <asp:Image ID="YourSuggestionImage" runat="server" ImageUrl="~/Images/Icons/arrowup.png"
                                     ToolTip="<%$ Resources:Resource, Friends_YourSuggestionImageToolTip %>" Visible='<%# Eval("SuggestedByUser") %>' />
                                </td>--%>
                               
                            </tr>
                        </table>
                    
                    
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%">
                <HeaderTemplate>
                    <asp:ImageButton ID="SortByRecordLeaguePositionImageButton" runat="server" ImageUrl="~/Images/Icons/LeaguePosition.png"
                     OnClick="SortByLeaguePositionRecord" ToolTip="<%$ Resources:Resource, Friends_LeaguePositionImageButtonToolTip %>" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="RecordLeaguePositionLabel" runat="server" Text='<%# Eval("RecordLeaguePosition") %>'
                     SkinID="GridLabel" ToolTip="<%$ Resources:Resource, Friends_LeaguePositionImageButtonToolTip %>"></asp:Label>
                </ItemTemplate>                
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%">
                <HeaderTemplate>
                    <asp:ImageButton ID="SortByRecordWinningSequenceButton" runat="server" ImageUrl="~/Images/Icons/Winning.png"
                     OnClick="SortByRecordWinningSequence" ToolTip="<%$ Resources:Resource, Friends_RecordWinningSequenceButtonToolTip %>"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="RecordWinningSequenceLabel" runat="server" Text='<%# Eval("RecordWinningSequence") %>'
                     SkinID="GridLabel" ToolTip="<%$ Resources:Resource, Friends_RecordWinningSequenceButtonToolTip %>"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%">
                <HeaderTemplate>
                    <asp:ImageButton ID="SortByRecordWinningSequenceThisSeasonButton" runat="server" ImageUrl="~/Images/Icons/WinningSeason.png"
                     OnClick="SortByRecordWinningSequenceThisSeason" ToolTip="<%$ Resources:Resource, Friends_RecordWinningSequenceThisSeasonButtonToolTip %>"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="RecordWinningSequenceThisSeasonLabel" runat="server" Text='<%# Eval("RecordWinningSequenceThisSeason") %>'
                     SkinID="GridLabel" ToolTip="<%$ Resources:Resource, Friends_RecordWinningSequenceThisSeasonButtonToolTip %>"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%">
                <HeaderTemplate>
                    <asp:ImageButton ID="RecordUnbeatenSequenceButton" runat="server" ImageUrl="~/Images/Icons/Unbeaten.png"
                     OnClick="SortByRecordUnbeatenSequence" ToolTip="<%$ Resources:Resource, Friends_RecordUnbeatenSequenceToolTip %>"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="RecordUnbeatenSequenceLabel" runat="server" Text='<%# Eval("RecordUnbeatenSequence") %>'
                     SkinID="GridLabel" ToolTip="<%$ Resources:Resource, Friends_RecordUnbeatenSequenceToolTip %>"></asp:Label>                    
                </ItemTemplate>
                
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%">
                 <HeaderTemplate>
                    <asp:ImageButton ID="RecordUnbeatenSequenceThisSeasonButton" runat="server" ImageUrl="~/Images/Icons/UnbeatenSeason.png"
                     OnClick="SortByRecordUnbeatenSequenceThisSeason" ToolTip="<%$ Resources:Resource, Friends_RecordUnbeatenSequenceThisSeasonToolTip %>"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="RecordUnbeatenSequenceThisSeasonLabel" runat="server" Text='<%# Eval("RecordUnbeatenSequenceThisSeason") %>'
                     SkinID="GridLabel" ToolTip="<%$ Resources:Resource, Friends_RecordUnbeatenSequenceThisSeasonToolTip %>"></asp:Label>                    
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%">
                <HeaderTemplate>
                    <asp:ImageButton ID="RecordGoalsScoredInOneGameButton" runat="server" ImageUrl="~/Images/Icons/GoalsOneGame.png"
                     OnClick="SortByRecordGoalsScoredInOneGame" ToolTip="<%$ Resources:Resource, Friends_RecordGoalsScoredInOneGameToolTip %>"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="RecordGoalsScoredInOneGameLabel" runat="server" Text='<%# Eval("RecordGoalsScoredInOneGame") %>'
                     SkinID="BlackHyperLinkSkin" ToolTip="<%$ Resources:Resource, Friends_RecordGoalsScoredInOneGameToolTip %>"
                      NavigateUrl='<%# "~/MatchPage.aspx?MatchId=" + Eval("RecordGoalsScoredInOneGameMatchId") %>'></asp:HyperLink>                                     
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%">
                <HeaderTemplate>
                    <asp:ImageButton ID="RecordGoalsInOneMatchBothTeamsButton" runat="server" ImageUrl="~/Images/Icons/GoalsBoth.png"
                     OnClick="SortByRecordGoalsInOneMatchBothTeams" ToolTip="<%$ Resources:Resource, Friends_RecordGoalsInOneMatchBothTeamsToolTip %>"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="RecordGoalsInOneMatchBothTeamsLabel" runat="server" Text='<%# Eval("RecordGoalsInOneMatchBothTeams") %>'
                     SkinID="BlackHyperLinkSkin" ToolTip="<%$ Resources:Resource, Friends_RecordGoalsInOneMatchBothTeamsToolTip %>"
                      NavigateUrl='<%# "~/MatchPage.aspx?MatchId=" + Eval("RecordGoalsBothTeamsMatchId") %>'></asp:HyperLink>                                     
                </ItemTemplate>
            </asp:TemplateField>
            
           <%--
            for future development:
            record transfer
            top player ratings
            stadium size         
           
           --%>
            
            
            <asp:TemplateField ItemStyle-Width="5%">
                <ItemTemplate>
                    <asp:ImageButton ID="StopBeingFriendsImageButton" runat="server" ImageUrl="~/Images/Icons/Friendship_Declined.png"
                     CommandName="Delete" CommandArgument='<%# Eval("SuggestionId") %>'
                     OnClientClick='<%# StopFriendshipOnClientClick() %>'
                     ToolTip="<%$ Resources:Resource, Friends_StopBeingFriendsToolTipText %>"
                     Visible='<%# !(bool)Eval("IsTheUser") %>' />
                </ItemTemplate>                            
            </asp:TemplateField>
        
        </Columns>
    </asp:GridView>
     <br />
    <asp:HyperLink ID="BlackListHyperlink" runat="server" SkinID="GreenTitleHyperLink" NavigateUrl="~/FriendsBlackList.aspx"
     Text="<%$ Resources:Resource, Global_BlackList %>">
    </asp:HyperLink>
    
    <%--<asp:ListView ID="FriendsListView" runat="server" DataSourceID="MyFriendsDataSourse" OnItemCommand="DeleteFriend" >
        <LayoutTemplate>
            <asp:Label ID="itemplaceholder" runat="server"></asp:Label>
        </LayoutTemplate>
        <ItemTemplate>
            <table cellpadding="3" cellspacing="0" style="display:inline;background-color:#F4F3F3; width:32%; ">
                <tr>
                    <td style="width:48px;background-color:#F4F3F3;">
                        <asp:Image ID="UserImage" runat="server" ImageUrl='<%# Eval("Picture") %>' Height="48"/>
                    </td>
                    <td style="text-align:left;background-color:#F4F3F3;width: 100px;">
                         <asp:HyperLink ID="UserNameHyperlink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("PublicName") %>'
                         NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("FriendId")%>' ></asp:HyperLink>
                         <br />
                        <asp:HyperLink ID="TeamHyperlink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("TeamName") %>'
                         NavigateUrl='<%# "~/TeamHomePage.aspx?TeamId=" + Eval("TeamId") %>'></asp:HyperLink>
                    </td>
                    <td style="background-color:#F4F3F3;">
                        <asp:ImageButton ID="StopBeingFriendsImageButton" runat="server" ImageUrl="~/Images/Icons/Friendship_Declined.jpg"
                         CommandName="Delete" CommandArgument='<%# Eval("SuggestionId") %>'
                         OnClientClick='<%# StopFriendshipOnClientClick() %>'
                         ToolTip="<%$ Resources:Resource, Friends_StopBeingFriendsToolTipText %>" />
                    </td>
                </tr>
            </table>
            
        </ItemTemplate>
    </asp:ListView>--%>
    
    <asp:SqlDataSource ID="MyFriendsDataSourse" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_FriendshipGetListOfFriends" SelectCommandType="StoredProcedure" >
        <SelectParameters>
            <asp:ControlParameter ControlID="SortByHiddenField" Name="OrderBy" PropertyName="Value" />
            <asp:ControlParameter ControlID="SortAscDescHiddenField" Name="AscDesc" PropertyName="Value" />
        </SelectParameters>
     </asp:SqlDataSource>
      <asp:HiddenField ID="SortByHiddenField" runat="server" Value="Date"/>
    <asp:HiddenField ID="SortAscDescHiddenField" runat="server" Value="ASC" />
    <br /><br />
    </ContentTemplate>
     </asp:UpdatePanel>
    </div>
    </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
</asp:Content>
